<?php

function accessdb_connect() {
  mysql_connect($config_db_host, $config_db_user, $config_db_password);
  mysql_select_db($config_db_database);
}

function accessdb_query($sql) {
  accessdb_connect();
  $result = mysql_query($sql);
  return mysql_fetch_assoc($result);
}

function accessdb_find($arrayCriterion) {
  foreach($arrayCriterion as $key => $value) {
    $field = substr($key, 0, -2);
    $operation = substr($key, -2);
    
    switch ($operation) {
      case "li":
        $operator = "like";
        break;
      case "eq":
        $operator = "=";
        break;
    }
    
    $sql .= $field . ' ' . $operator . ' ' . $value;
  }

}
